package com.yy.wga.common.feign.config.config;

import com.yy.wga.common.core.dto.BaseReqDTO;
import com.yy.wga.common.web.intereceptor.RequestHolder;
import feign.RequestInterceptor;
import feign.RequestTemplate;

/**
 * feign拦截器
 *
 * @author guochao
 * @des 描述内容
 * @date 2023-08-30
 */
public class WgaFeignRequestInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        BaseReqDTO baseRequest = RequestHolder.getBaseRequest();
        if (baseRequest != null) {
            template.header("appKey", baseRequest.getAppKey());
            template.header("clientVersion", baseRequest.getClientVersion());
            Integer sysType = baseRequest.getSysType();
            if (sysType != null) {
                template.header("sysType", sysType.toString());
            }
        }
    }
}
